from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
class Base():
    def __init__(self,dr):
        self.dr=dr
    def get_url(self,url):
        self.dr.get(url)
    def find_element(self,loc):
        try:
            WebDriverWait(self.dr,20,0.5).until(lambda dr:self.dr.find_element(*loc))
            return self.dr.find_element(*loc)
        except Exception as e:
            print(e)
    def click(self,loc):
        self.find_element(loc).click()
    def send_keys(self,loc,info):
        self.find_element(loc).send_keys(info)
    def text(self,loc):
        return self.find_element(loc).text
    def switch_toframe(self,loc):
        a=self.find_element(loc)
        self.dr.switch_to.frame(a)